package tk.xboot.flink.cep.mc.events;

import java.util.Objects;

public class TemperatureWarning {

    private int rackId;
    private double averageTemperature;

    public TemperatureWarning(int rackId, double averageTemperature) {
        this.rackId = rackId;
        this.averageTemperature = averageTemperature;
    }

    public TemperatureWarning() {
        this(-1, -1);
    }

    public int getRackId() {
        return rackId;
    }

    public void setRackId(int rackId) {
        this.rackId = rackId;
    }

    public double getAverageTemperature() {
        return averageTemperature;
    }

    public void setAverageTemperature(double averageTemperature) {
        this.averageTemperature = averageTemperature;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TemperatureWarning)) return false;
        TemperatureWarning that = (TemperatureWarning) o;
        return rackId == that.rackId &&
                Double.compare(that.averageTemperature, averageTemperature) == 0;
    }

    @Override
    public int hashCode() {
        return Objects.hash(rackId, averageTemperature);
    }

    @Override
    public String toString() {
        return "TemperatureWarning(" + getRackId() + " , " + getAverageTemperature() + ")";
    }
}
